Audio In Unity
Unity Audio Overview Internally, Unity's default audio system is built on top of the FMOD Low Level API. This does not support FMOD Studio but that integration is offered separately (see below). The first stop for learning about Unity audio is to read up on audio in the [http://docs.unity3d.com/Manual/Audio.html official documentation]. Unity's Audio system is fairly comprehensive and extremely flexible. It is worth it to at least skim the sections in the documentation to at least get an idea of the scope of the available systems. The WebGL Exception According to Unity's documentation: Audio in WebGL is done differently then on all other platforms. On other platforms we use FMOD internally to supply audio playback and mixing. Since the WebGL platform does not support threads, we need to use a different implementation, which is internally based on the Web Audio API, which lets the browser handle audio playback and mixing for us. Unfortunately, this limits audio functionality in Unity WebGL to supporting only the most basic features. The specific features are outlined in the [http://docs.unity3d.com/Manual/webgl-audio.html official manual page]. Unity Audio Demos and Native Plugins Unity 5 brought several major enhancements to Unity's Audio system, including the [http://docs.unity3d.com/Manual/AudioMixer.html AudioMixer] and [http://docs.unity3d.com/Manual/AudioMixerNativeAudioPlugin.html Native Audio Plugins]. Less-well known is that they have open-sourced several demos and native plugins that you're welcome to use for free. These can be obtained here: * [https://bitbucket.org/Unity-Technologies/audiodemos Audio System Demos] * [https://bitbucket.org/Unity-Technologies/nativeaudioplugins Native Audio Plugins] Things the Manual Doesn't Tell You What follows is some information tidbits that were gleaned from various sources and don't appear in any official documentation. If you find that these morsels ''do'' appear in documentation, please update the page with the clarifications! Unity 5+ Recompression Since Unity 5, Unity '''recompresses all audio data'''. See: ''We don't support ogg audio in the unity audio formats, we support a completely separate implementation of vorbis with a custom container type. No Ogg.'' ''This is chosen for:'' # ''Ogg includes an unnecessary amount of bloat that we don't require.'' # ''Our Ogg-less decoder is much faster than the default ogg-vorbis codec, and uses less memory.'' ''So no, there is no way to avoid re-compression. ...'' '''''You should not be importing already compressed audio into Unity.''' Instead you should import the uncompressed source WAV files into Unity and decide your compression scheme in Unity. ...'' ''When importing audio, you can chose to preserve the sample rate of the original file, select a different rate, or let us optimise the rate intelligently.'' ''The quality slider of the compression is mapped to the standard quality scale of vorbis [-1, 10].'' '''''Moral of the story is don't import already compressed audio into Unity, thats wrong.''''' It is important to note that the above quote is specifically referring to post-build audio formats. Ogg audio '''''is''''' supported in the Unity Editor. The quote simply explains that '''''during a build''''' Unity will recompress audio data using a custom format. '''Source:''' the Unity Beta list.Unity Beta List topic "compressed .ogg audio is recompressed on import, even at quality 100", message from 11/30/2015 Unity Audio Middleware There are several audio middleware tools available for Unity, ranging from useful interface enhancements to entire audio sub-system replacements. Some of these include: * [https://www.assetstore.unity3d.com/en/#!/search/page=1/sortby=relevance/query=clockstone Clockstone] * [https://www.assetstore.unity3d.com/en/#!/content/5607 Master Audio] * [https://www.assetstore.unity3d.com/en/#!/content/15325 SECTR Audio] * [http://www.tazman-audio.co.uk/#!fabric Fabric Audio] * [http://www.fmod.org/download/#StudioExtras FMOD] * [https://www.audiokinetic.com/products/wwise-integration/ Wwise] References